import { generateHighlightNodeForSalePrice } from '@/utils/bizUtils';
import { getEchoTextByValue } from '@/utils/getUtils';
/* 统一进价 */
export const viewUnifiedPurchaseColumns = [
  {
    title: 'SKU编码',
    key: 'skuNo',
    fixed: 'left'
  },
  {
    title: '商品名称',
    key: 'productName',
    fixed: 'left'
  },
  {
    title: '规格',
    key: 'specDetailStr',
    fixed: 'left'
  },
  {
    title: '供货计量单位',
    key: 'supplyGoodsUnit',
    align: 'center',
    minWidth: 150
  },
  {
    title: '进价类型',
    minWidth: 150,
    render: (h, { row }) => {
      return (<span>{ row.purchasePriceType === '1' ? '统一进价' : '区域进价' }</span>)
    }
  }, {
    title: '销售区域',
    key: 'saleAreaShortNames',
  },
  {
    title: '主计量进价',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原进价',
        align: 'center',
        key: 'oldMainPurchasePrice',
        minWidth: 150,
      },
      {
        title: '现进价',
        align: 'center',
        key: 'mainPurchasePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldMainPurchasePrice, row.mainPurchasePrice)
        }
      }
    ]
  },
  {
    title: '进价浮动比率',
    key: 'mainPurchasePriceFloatRadio',
    align: 'center',
    minWidth: 150
  },
  {
    title: '厂家面价',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原价',
        align: 'center',
        minWidth: 150,
        key: 'oldFactoryFacePrice',
      },
      {
        title: '现价',
        align: 'center',
        minWidth: 150,
        key: 'factoryFacePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldFactoryFacePrice, row.factoryFacePrice)
        }
      }
    ]
  },
  {
    title: '进价备注',
    minWidth: 150,
    align: 'center',
    children: [
      {
        title: '原价',
        minWidth: 150,
        align: 'center',
        key: 'oldPurchasePriceNote',
      },
      {
        title: '现价',
        minWidth: 150,
        align: 'center',
        key: 'purchasePriceNote',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldPurchasePriceNote, row.purchasePriceNote)
        }
      }
    ]
  },
  {
    title: '加价类型',
    align: 'center',
    key: 'addPriceTypeStr',
    minWidth: 150
  },
  {
    title: '运费比例或金额',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldFreightRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'freightRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldFreightRatio, row.freightRatio)
        }
      },
    ]
  },
  {
    title: '包装比例或金额',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldPackRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'packRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldPackRatio, row.packRatio)
        }
      },
    ]
  },
  {
    title: '加工费比例或金额',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldProcessChargesRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'processChargesRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldProcessChargesRatio, row.processChargesRatio)
        }
      },
    ]
  },
  {
    title: '返利折合比例或金额',
    align: 'center',
    minWidth: 180,
    children: [
      {
        title: '原值',
        key: 'oldRebateRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'rebateRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldRebateRatio, row.rebateRatio)
        }
      },
    ]
  },
  {
    title: '返利说明',
    align: 'center',
    minWidth: 180,
    children: [
      {
        title: '原值',
        key: 'oldRebateRatioDesc',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'rebateRatioDesc',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldRebateRatioDesc, row.rebateRatioDesc)
        }
      },
    ]
  },
  {
    title: '成本价',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldMainUnitCostPrice',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'mainUnitCostPrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldMainUnitCostPrice, row.mainUnitCostPrice)
        }
      },
    ]
  },
  {
    title: '成本价浮动比率',
    key: 'mainUnitCostFloatPrice',
    align: 'center',
    minWidth: 150
  },
]
/* 区域进价 */
export const viewAreaPurchaseColumns = [
  {
    title: 'SKU编码',
    key: 'skuNo',
    fixed: 'left'
  },
  {
    title: '商品名称',
    key: 'productName',
    fixed: 'left'
  },
  {
    title: '规格',
    key: 'specDetailStr',
    fixed: 'left'
  },
  {
    title: '参照城市',
    key: 'templateCityName',
    align: 'center',
    fixed: 'left'
  },
  {
    title: '供货计量单位',
    key: 'supplyGoodsUnit',
    align: 'center',
    minWidth: 150
  },
  {
    title: '业务区域',
    key: 'templateCitySaleAreaName',
    align: 'center',
    minWidth: 150
  },
  {
    title: '进价类型',
    minWidth: 150,
    render: (h, { row }) => {
      return (<span>{ row.purchasePriceType === '1' ? '统一进价' : '区域进价' }</span>)
    }
  }, {
    title: '销售区域',
    key: 'saleAreaShortNames',
    align: 'center',
    minWidth: 150
  },
  {
    title: '主计量进价',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原进价',
        align: 'center',
        key: 'oldMainPurchasePrice',
        minWidth: 150,
      },
      {
        title: '现进价',
        align: 'center',
        key: 'mainPurchasePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldMainPurchasePrice, row.mainPurchasePrice)
        }
      }
    ]
  },
  {
    title: '进价浮动比率',
    key: 'mainPurchasePriceFloatRadio',
    align: 'center',
    minWidth: 150
  },
  {
    title: '厂家面价',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原价',
        align: 'center',
        minWidth: 150,
        key: 'oldFactoryFacePrice',

      },
      {
        title: '现价',
        align: 'center',
        minWidth: 150,
        key: 'factoryFacePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldFactoryFacePrice, row.factoryFacePrice)
        }
      }
    ]
  },
  {
    title: '进价备注',
    minWidth: 150,
    align: 'center',
    children: [
      {
        title: '原价',
        minWidth: 150,
        align: 'center',
        key: 'oldPurchasePriceNote',
      },
      {
        title: '现价',
        minWidth: 150,
        align: 'center',
        key: 'purchasePriceNote',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldPurchasePriceNote, row.purchasePriceNote)
        }
      }
    ]
  },
  {
    title: '加价类型',
    align: 'center',
    key: 'addPriceTypeStr',
    minWidth: 150
  },
  {
    title: '运费比例或金额',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldFreightRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'freightRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldFreightRatio, row.freightRatio)
        }
      },
    ]
  },
  {
    title: '包装比例或金额',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldPackRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'packRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldPackRatio, row.packRatio)
        }
      },
    ]
  },
  {
    title: '加工费比例或金额',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldProcessChargesRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'processChargesRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldProcessChargesRatio, row.processChargesRatio)
        }
      },
    ]
  },
  {
    title: '返利折合比例或金额',
    align: 'center',
    minWidth: 180,
    children: [
      {
        title: '原值',
        key: 'oldRebateRatio',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'rebateRatio',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldRebateRatio, row.rebateRatio)
        }
      },
    ]
  },
  {
    title: '返利说明',
    children: [
      {
        title: '原值',
        key: 'oldRebateRatioDesc',
      },
      {
        title: '现值',
        key: 'rebateRatioDesc',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldRebateRatioDesc, row.rebateRatioDesc)
        }
      },
    ]
  },
  {
    title: '成本价',
    align: 'center',
    minWidth: 150,
    children: [
      {
        title: '原值',
        key: 'oldMainUnitCostPrice',
        align: 'center',
        minWidth: 150
      },
      {
        title: '现值',
        key: 'mainUnitCostPrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldMainUnitCostPrice, row.mainUnitCostPrice)
        }
      },
    ]
  },
  {
    title: '成本价浮动比率',
    key: 'mainUnitCostFloatPrice',
    align: 'center',
    minWidth: 150
  },
]
/* 查看参考城市关系 */
export const viewReferenceCityColumns = [
  {
    title: '销售城市',
    key: 'saleCityName',
    minWidth: 150,
    align: 'center',
  },
  {
    title: '供货城市',
    key: 'saleProvinceName',
    minWidth: 150,
    align: 'center'
  }, {
    title: '是否供货',
    minWidth: 70,
    align: 'center',
    render: (h, { row }) => {
      return <span>{getEchoTextByValue({ val: row.isSupply })}</span>
    }
  },
  {
    title: '区域',
    key: 'saleAreaName',
    minWidth: 150,
    align: 'center'
  },
  {
    title: '参照城市',
    key: 'templateCityName',
    minWidth: 150,
    align: 'center'
  },
  {
    title: '进价比例',
    key: 'buyPriceRatio',
    minWidth: 150,
    align: 'center'
  },
  {
    title: '成本价比例',
    key: 'costPriceRatio',
    minWidth: 150,
    align: 'center'
  }
]
